﻿Imports System.Diagnostics
Imports System.IO

Public Class Form1

    Private Sub btnGenerateReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerateReport.Click

        Dim fp As Int16
        Dim fy As Int16

        If IsDBNull(cbFiscalPeriod.SelectedItem) Then
            fp = 10
        Else
            fp = cbFiscalPeriod.SelectedItem
        End If

        If IsDBNull(cbFiscalYear.SelectedItem) Then
            fy = 2011
        Else
            fy = cbFiscalYear.SelectedItem
        End If

        Dim myDP As DataProcessor = New DataProcessor(fy, fp)
        myDP.ProcessData()

        'Dim path As String = Directory.GetCurrentDirectory()
        Dim path As String = AppDomain.CurrentDomain.BaseDirectory

        Process.Start("Excel.exe", path & "FinRpt")



    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If cbFiscalYear.Items.Count > 0 Then
            cbFiscalYear.SelectedIndex = 2 ' The first item has index 0 '  
        End If

        If cbFiscalPeriod.Items.Count > 0 Then
            cbFiscalPeriod.SelectedIndex = 10 ' The first item has index 0 '  
        End If
       
    End Sub
End Class
